%%
%% This is file `caption3.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% caption.dtx  (with options: `kernel')
%% 
%% Copyright (C) 1994-2005 Axel Sommerfeldt (caption@sommerfeldt.net)
%% 
%% --------------------------------------------------------------------------
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".
%% 
%% This Current Maintainer of this work is Axel Sommerfeldt.
%% 
%% This work consists of the files caption.ins, caption.dtx,
%% caption2.dtx, caption.xml, and anleitung.tex and the derived files
%% caption.sty, caption2.sty, caption3.sty, and manual.tex.
%% 
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{caption3}[2005/06/11 v3.0f caption3 kernel (AS)]
\providecommand*\@nameundef[1]{%
  \expandafter\let\csname #1\endcsname\@undefined}
\providecommand\l@addto@macro[2]{%
  \begingroup
    \toks@\expandafter{#1#2}%
    \edef\@tempa{\endgroup\def\noexpand#1{\the\toks@}}%
  \@tempa}
\def\bothIfFirst#1#2{%
  \protected@edef\caption@tempa{#1}%
  \ifx\caption@tempa\@empty\else
    #1#2%
  \fi}
\def\bothIfSecond#1#2{%
  \protected@edef\caption@tempa{#2}%
  \ifx\caption@tempa\@empty\else
    #1#2%
  \fi}
\def\caption@ifinlist#1#2{%
  \let\next\@secondoftwo
  \edef\caption@tempa{#1}%
  \@for\caption@tempb:={#2}\do{%
    \ifx\caption@tempa\caption@tempb
      \let\next\@firstoftwo
    \fi}%
  \next}
\def\caption@setbool#1#2{%
  \caption@ifinlist{#2}{1,true,yes,on}{%
    \expandafter\let\csname caption@if#1\endcsname\@firstoftwo
  }{\caption@ifinlist{#2}{0,false,no,off}{%
    \expandafter\let\csname caption@if#1\endcsname\@secondoftwo
  }{%
    \PackageError{caption}{Undefined boolean value `#2'}{\caption@eh}%
  }}}
\def\caption@ifbool#1{\@nameuse{caption@if#1}}
\RequirePackage{keyval}[1997/11/10]
\providecommand*\undefine@key[2]{%
  \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}}
\newcommand\DeclareCaptionOption{%
  \@ifstar{\caption@declareoption\AtEndOfPackage}%
          {\caption@declareoption\@gobble}}
\newcommand*\caption@declareoption[2]{%
  #1{\undefine@key{caption}{#2}}\define@key{caption}{#2}}
\@onlypreamble\DeclareCaptionOption
\@onlypreamble\caption@declareoption
\def\captionsetup{\@ifnextchar[\caption@setuptype\caption@setup}
\def\caption@setuptype[#1]#2{%
  \@ifundefined{caption@typ@#1}%
    {\@namedef{caption@typ@#1}{#2}}%
    {\expandafter\l@addto@macro\csname caption@typ@#1\endcsname{,#2}}}
\def\caption@setup{\setkeys{caption}}
\def\caption@settype#1{%
  \@ifundefined{caption@typ@#1}{}{%
    \caption@esetup{\csname caption@typ@#1\endcsname}}}
\def\caption@esetup#1{%
  \edef\caption@tempa{\noexpand\caption@setup{#1}}%
  \caption@tempa}
\newcommand*\clearcaptionsetup[1]{\@nameundef{caption@typ@#1}}
\newcommand*\showcaptionsetup[2][\@firstofone]{%
  \GenericWarning{}{%
    #1 Caption Info: KV list on `#2'\MessageBreak
    #1 Caption Data: (%
    \@ifundefined{caption@typ@#2}{%
      % Empty -- print nothing.
    }{%
      \@nameuse{caption@typ@#2}%
    }%
    )}}
\newcommand\caption@eh{%
  If you do not understand this error, please take a closer look\MessageBreak
  at the documentation of the `caption' package.\MessageBreak
  \@ehc}
\newdimen\captionmargin
\newdimen\captionwidth
\newif\ifcaption@width
\DeclareCaptionOption{margin}{\caption@setmargin{#1}}
\DeclareCaptionOption{width}{\caption@setwidth{#1}}
\newcommand\caption@setmargin{%
  \caption@widthfalse
  \setlength\captionmargin}
\newcommand\caption@setwidth{%
  \caption@widthtrue
  \setlength\captionwidth}
\newdimen\captionindent
\newdimen\captionparindent
\newdimen\captionhangindent
\DeclareCaptionOption{indent}[\leftmargini]{\setlength\captionindent{#1}}% obsolete!
\DeclareCaptionOption{indention}[\leftmargini]{\setlength\captionindent{#1}}
\DeclareCaptionOption{parindent}[\parindent]{\setlength\captionparindent{#1}}% changed v3.0b
\DeclareCaptionOption{hangindent}[0pt]{\setlength\captionhangindent{#1}}% changed v3.0b
\newcommand*\DeclareCaptionStyle[1]{%
  \@ifnextchar[{\caption@declarestyle{#1}}{\caption@declarestyle{#1}[]}}
\def\caption@declarestyle#1[#2]#3{%
  \global\@namedef{caption@sls@#1}{#2}%
  \global\@namedef{caption@sty@#1}{#3}}
\@onlypreamble\DeclareCaptionStyle
\@onlypreamble\caption@declarestyle
\DeclareCaptionOption{style}{\caption@setstyle{#1}}
\newcommand\caption@setstyle{%
  \@ifstar{\caption@@setstyle\@gobble}{\caption@@setstyle\@firstofone}}
\newcommand*\caption@@setstyle[2]{%
  \@ifundefined{caption@sty@#2}%
    {#1{\PackageError{caption}{Undefined caption style `#2'}{\caption@eh}}}%
{\expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname
     \caption@setdefault\caption@esetup{\csname caption@sty@#2\endcsname}}}
\newcommand\caption@setdefault{\captionsetup{%
  format=default,labelformat=default,labelsep=default,justification=default,%
  font=default,labelfont=default,textfont=default,%
  margin=0pt,indention=0pt,parindent=0pt,hangindent=0pt,singlelinecheck}}
\DeclareCaptionStyle{default}[indent=0pt,justification=centering]{}
\def\DeclareCaptionFormat{%
  \@ifstar{\caption@declareformat\@gobble}{\caption@declareformat\@firstofone}}
\newcommand\caption@declareformat[3]{%
  \global\expandafter\let\csname caption@ifh@#2\endcsname#1%
  \global\long\expandafter\def\csname caption@fmt@#2\endcsname##1##2##3{#3}}
\@onlypreamble\DeclareCaptionFormat
\@onlypreamble\caption@declareformat
\DeclareCaptionOption{format}{\caption@setformat{#1}}
\newcommand*\caption@setformat[1]{%
  \@ifundefined{caption@fmt@#1}%
    {\PackageError{caption}{Undefined caption format `#1'}{\caption@eh}}%
    {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname
     \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}}
\DeclareCaptionFormat{@normal}{#1#2#3\par}
\DeclareCaptionFormat{hang}{%
  \@hangfrom{#1#2}%
  \advance\captionparindent\hangindent
  \advance\captionhangindent\hangindent
  \caption@@par
  #3\par}
\def\caption@fmt@default{\caption@fmt@@normal}
\def\caption@ifh@default{\caption@ifh@@normal}% bugfix v3.0e (05-04-28)
\newcommand*\DeclareCaptionLabelFormat[2]{%
  \global\expandafter\def\csname caption@lfmt@#1\endcsname##1##2{#2}}
\@onlypreamble\DeclareCaptionLabelFormat
\DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}}
\newcommand*\caption@setlabelformat[1]{%
  \@ifundefined{caption@lfmt@#1}%
    {\PackageError{caption}{Undefined caption label format `#1'}{\caption@eh}}%
    {\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}}
\DeclareCaptionLabelFormat{empty}{}
\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2}
\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)}
\def\caption@lfmt@default{\caption@lfmt@simple}
\newcommand\DeclareCaptionLabelSeparator[2]{%
  \global\long\@namedef{caption@lsep@#1}{#2}}
\@onlypreamble\DeclareCaptionLabelSeparator
\DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}}
\DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}}
\newcommand*\caption@setlabelseparator[1]{%
  \@ifundefined{caption@lsep@#1}%
    {\PackageError{caption}{Undefined caption label separator `#1'}{\caption@eh}}%
    {\expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}}
\DeclareCaptionLabelSeparator{none}{}
\DeclareCaptionLabelSeparator{colon}{: }
\DeclareCaptionLabelSeparator{period}{. }
\DeclareCaptionLabelSeparator{space}{ }
\DeclareCaptionLabelSeparator{quad}{\quad}
\DeclareCaptionLabelSeparator{newline}{\\}% 05-03-23 (v3.0f)
\def\caption@lsep@default{\caption@lsep@colon}
\newcommand*\DeclareCaptionJustification[2]{%
  \global\@namedef{caption@hj@#1}{#2}}
\@onlypreamble\DeclareCaptionJustification
\DeclareCaptionOption{justification}{\caption@setjustification{#1}}
\newcommand*\caption@setjustification[1]{%
  \@ifundefined{caption@hj@#1}%
    {\PackageError{caption}{Undefined caption justification `#1'}{\caption@eh}}%
    {\expandafter\let\expandafter\caption@hj\csname caption@hj@#1\endcsname}}
\DeclareCaptionJustification{justified}{}
\DeclareCaptionJustification{centering}{\centering}
\DeclareCaptionJustification{centerfirst}{\caption@centerfirst}
\DeclareCaptionJustification{centerlast}{\caption@centerlast}
\DeclareCaptionJustification{raggedleft}{\raggedleft}
\DeclareCaptionJustification{raggedright}{\raggedright}
\def\caption@hj@default{\caption@hj@justified}
\newcommand\caption@centerfirst{%
  \edef\caption@normaladjust{%
    \leftskip\the\leftskip
    \rightskip\the\rightskip
    \parfillskip\the\parfillskip\relax}%
  \leftskip\z@\@plus -1fil%
  \rightskip\z@\@plus 1fil%
  \parfillskip\z@skip
  \noindent\hskip\z@\@plus 2fil%
  \@setpar{\@@par\@restorepar\caption@normaladjust}}
\newcommand\caption@centerlast{%
  \leftskip\z@\@plus 1fil%
  \rightskip\z@\@plus -1fil%
  \parfillskip\z@\@plus 2fil\relax}
\DeclareCaptionJustification{Centering}{%
  \caption@ragged\Centering\centering}
\DeclareCaptionJustification{RaggedLeft}{%
  \caption@ragged\RaggedLeft\raggedleft}
\DeclareCaptionJustification{RaggedRight}{%
  \caption@ragged\RaggedRight\raggedright}
\newcommand*\caption@ragged[2]{%
  \@ifundefined{caption\string#1}{%
    \PackageWarning{caption}{%
      Cannot locate the `ragged2e' package, therefore\MessageBreak
      substituting \string#2 for \string#1\MessageBreak}%
    \global\@namedef{caption\string#1}}{}%
  #2}
\AtBeginDocument{\IfFileExists{ragged2e.sty}{%
  \RequirePackage{ragged2e}\let\caption@ragged\@firstoftwo}{}}
\newcommand\DeclareCaptionFont[2]{%
  \define@key{caption@fnt}{#1}[]{\g@addto@macro\caption@tempa{#2}}}
\@onlypreamble\DeclareCaptionFont
\DeclareCaptionOption{font}{\caption@setfont{font}{#1}}
\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}}
\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}}
\newcommand*\caption@setfont[2]{%
  \let\caption@tempa\@empty
  \begingroup
    \setkeys{caption@fnt}{#2}%
  \endgroup
  \expandafter\let\csname caption#1\endcsname\caption@tempa}
\DeclareCaptionFont{default}{}
\DeclareCaptionFont{scriptsize}{\scriptsize}
\DeclareCaptionFont{footnotesize}{\footnotesize}
\DeclareCaptionFont{small}{\small}
\DeclareCaptionFont{normalsize}{\normalsize}
\DeclareCaptionFont{large}{\large}
\DeclareCaptionFont{Large}{\Large}
\DeclareCaptionFont{up}{\upshape}
\DeclareCaptionFont{it}{\itshape}
\DeclareCaptionFont{sl}{\slshape}
\DeclareCaptionFont{sc}{\scshape}
\DeclareCaptionFont{md}{\mdseries}
\DeclareCaptionFont{bf}{\bfseries}
\DeclareCaptionFont{rm}{\rmfamily}
\DeclareCaptionFont{sf}{\sffamily}
\DeclareCaptionFont{tt}{\ttfamily}
\providecommand\captionsize{}
\DeclareCaptionOption{size}{\caption@setfont{size}{#1}}% changed v3.0a
\@ifundefined{abovecaptionskip}{%
  \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
\@ifundefined{belowcaptionskip}{%
  \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
\DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}}
\DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}}
\DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}}% new 3.0d
\DeclareCaptionOption{position}{\caption@setposition{#1}}
\newcommand*\caption@setposition[1]{%
  \caption@ifinlist{#1}{d,default}{%
    \def\caption@position{\caption@defaultpos}%
  }{\caption@ifinlist{#1}{t,top,above}{%
    \let\caption@position\@firstoftwo
  }{\caption@ifinlist{#1}{b,bottom,below}{%
    \let\caption@position\@secondoftwo
  }{\caption@ifinlist{#1}{a,auto}{%
    \let\caption@position\@undefined
  }{%
    \PackageError{caption}{Undefined caption position `#1'}{\caption@eh}%
  }}}}}
\let\caption@defaultpos\@secondoftwo
\newcommand\caption@iftop{% bugfixed v3.0a, improved v3.0d
  \ifx\caption@position\@undefined
    \expandafter\@secondoftwo
  \else
    \expandafter\caption@position
  \fi}
\newcommand\caption@fixposition{%
  \ifx\caption@position\@undefined
    \caption@autoposition
  \fi}
\newcommand\caption@autoposition{% bugfixed v3.0a
  \ifvmode
    \ifodd\caption@debug\relax
      \edef\caption@tempa{\the\prevdepth}%
      \PackageInfo{caption}{\protect\prevdepth=\caption@tempa}%
    \fi
    \ifdim\prevdepth>-\p@
      \let\caption@position\@secondoftwo
    \else
      \let\caption@position\@firstoftwo
    \fi
  \else
    \ifodd\caption@debug\relax
      \PackageInfo{caption}{no \protect\prevdepth}%
    \fi
    \let\caption@position\@secondoftwo
  \fi}
\newcommand\caption@beginhook{}
\newcommand\caption@endhook{}
\newcommand\AtBeginCaption{\l@addto@macro\caption@beginhook}
\newcommand\AtEndCaption{\l@addto@macro\caption@endhook}
\DeclareCaptionOption{parskip}[5pt]{\AtBeginCaption{\setlength\parskip{#1}}}
\DeclareCaptionOption{listof}{\caption@setbool{lof}{#1}}% new v3.0b
\DeclareCaptionOption{singlelinecheck}[1]{\caption@setbool{slc}{#1}}
\DeclareCaptionOption{strut}{\caption@setbool{strut}{#1}}% new v3.0d
\DeclareCaptionOption{debug}{\def\caption@debug{#1}}
\captionsetup{style=default,position=default,listof=1,strut=1,debug=0}
\newif\ifcaption@star
\newcommand\caption@make[2]{%
  \caption@@make{\caption@lfmt{#1}{#2}}}
\newcommand\caption@@make[2]{%
  \caption@beginhook
  \caption@calcmargin
  \caption@ifslc{%
    \ifx\caption@sls\@empty\else
      \caption@startslc
      \setbox\@tempboxa\hbox{\caption@@@make{#1}{#2}}%
      \ifdim\wd\@tempboxa >\captionwidth
        \caption@endslc
      \else
        \caption@endslc
        \caption@esetup\caption@sls
        \caption@calcmargin
      \fi
    \fi}{}%
  \@tempdima\captionmargin
  \caption@ifh{\advance\@tempdima by \captionindent}%
  \ifdim\@tempdima=\z@\else
    \hskip\@tempdima
  \fi
  \@tempdima\captionwidth
  \caption@ifh{\advance\@tempdima by -\captionindent}%
  \caption@startbox\@tempdima
    \caption@ifh{%
      \ifdim\captionindent=\z@
        \leavevmode
      \else
        \hskip-\captionindent
      \fi}%
    \caption@@@make{#1}{#2}%
  \caption@endbox
  \ifdim\captionmargin=\z@\else
    \hskip\captionmargin
  \fi
  \caption@endhook
  \global\caption@starfalse}
\newcommand\caption@calcmargin{%
  \ifcaption@width
    \captionmargin\hsize
    \advance\captionmargin by -\captionwidth
    \divide\captionmargin by 2
  \else
    \captionwidth\hsize
    \advance\captionwidth by -2\captionmargin
  \fi
  \ifodd\caption@debug\relax
    \PackageInfo{caption}{\protect\hsize=\the\hsize,
      \protect\margin=\the\captionmargin,
      \protect\width=\the\captionwidth}%
  \fi}
\newcommand\caption@startslc{%
  \begingroup
  \let\label\@gobble\let\@footnotetext\@gobble
  \def\stepcounter##1{\advance\csname c@##1\endcsname\@ne\relax}%
  \let\caption@hj\relax}
\newcommand\caption@endslc{%
  \endgroup}
\newcommand*\caption@startbox[1]{\vbox\bgroup\hsize#1}%
\newcommand*\caption@endbox{\egroup}
\newcommand\caption@@@make[2]{%
  \caption@ifempty{#2}{% changed v3.0e
    \let\caption@lsep\relax
    \let\caption@ifstrut\@secondoftwo % added v3.0e
  }%
  \def\caption@@par{%
    \parindent\captionparindent\hangindent\captionhangindent}%
  \@setpar{\@@par\caption@@par}\caption@@par
  \caption@hj\captionsize\captionfont
  \caption@fmt{\ifcaption@star\else{\captionlabelfont#1}\fi}%
              {\ifcaption@star\else{\captionlabelfont\caption@lsep}\fi}%
              {{\captiontextfont
                \caption@ifstrut{\vrule\@height\ht\strutbox\@width\z@}{}%
                \nobreak\hskip\z@skip
                #2%
                \caption@ifstrut{\@finalstrut\strutbox}{}%
                \par}}}
\newcommand\caption@ifempty[1]{%
  \def\caption@tempa{#1}%
  \def\caption@tempb{\ignorespaces}%
  \ifx\caption@tempa\caption@tempb
    \let\caption@tempa\@empty
  \fi
  \ifx\caption@tempa\@empty
    \expandafter\@firstofone
  \else
    \expandafter\@gobble
  \fi}
\endinput
%%
%% End of file `caption3.sty'.
